#include "volumeinformation.h"

QString
VolumeInformation::voxelTypeString()
{
  if (voxelType >= 0 &&
      voxelType < m_voxelTypeStrings.size())
    return m_voxelTypeStrings[voxelType];
  else
    return m_voxelTypeStrings[0];
}

QString
VolumeInformation::voxelUnitString()
{
  if (voxelUnit >= 0 &&
      voxelUnit < m_voxelUnitStrings.size())
    return m_voxelUnitStrings[voxelUnit];
  else
    return m_voxelUnitStrings[0];
}

QString
VolumeInformation::voxelUnitStringShort()
{
  if (voxelUnit >= 0 &&
      voxelUnit < m_voxelUnitStringsShort.size())
    return m_voxelUnitStringsShort[voxelUnit];
  else
    return m_voxelUnitStringsShort[0];
}

VolumeInformation::VolumeInformation()
{
  pvlFile = "";
  rawFile = "";
  description = "No description available";
  dimensions = Vec(0,0,0);
  voxelType = _UChar;
  voxelUnit = Nounit;
  voxelSize = Vec(1,1,1);
  relativeVoxelScaling = Vec(1,1,1);
  skipheaderbytes = 0;
  mapping.clear();
  slabSize = 0;
  repeatType = CycleType;

  m_voxelTypeStrings.clear();
  m_voxelTypeStrings << "unsigned char";
  m_voxelTypeStrings << "char";
  m_voxelTypeStrings << "unsigned short";
  m_voxelTypeStrings << "short";
  m_voxelTypeStrings << "int";
  m_voxelTypeStrings << "float";

  m_voxelUnitStrings.clear();
  m_voxelUnitStrings << "Nounit";
  m_voxelUnitStrings << "Angstrom";
  m_voxelUnitStrings << "Nanometer";
  m_voxelUnitStrings << "Micron";
  m_voxelUnitStrings << "Millimeter";
  m_voxelUnitStrings << "Centimeter";
  m_voxelUnitStrings << "Meter";
  m_voxelUnitStrings << "Kilometer";
  m_voxelUnitStrings << "Parsec";
  m_voxelUnitStrings << "Kiloparsec";

  m_voxelUnitStringsShort.clear();
  m_voxelUnitStringsShort << "";
  m_voxelUnitStringsShort << "A";
  m_voxelUnitStringsShort << "nm";
  m_voxelUnitStringsShort << "mi";
  m_voxelUnitStringsShort << "mm";
  m_voxelUnitStringsShort << "cm";
  m_voxelUnitStringsShort << "m";
  m_voxelUnitStringsShort << "km";
  m_voxelUnitStringsShort << "p";
  m_voxelUnitStringsShort << "kp";
}

VolumeInformation::~VolumeInformation()
{
  pvlFile = "";
  rawFile = "";
  description = "No description available";
  dimensions = Vec(0,0,0);
  voxelType = _UChar;
  voxelUnit = Nounit;
  voxelSize = Vec(1,1,1);
  relativeVoxelScaling = Vec(1,1,1);
  skipheaderbytes = 0;
  mapping.clear();
  slabSize = 0;

  m_voxelTypeStrings.clear();
  m_voxelUnitStrings.clear();
  m_voxelUnitStringsShort.clear();
}

VolumeInformation&
VolumeInformation::operator=(const VolumeInformation& V)
{
  pvlFile = V.pvlFile;
  rawFile = V.rawFile;
  description = V.description;
  dimensions = V.dimensions;
  voxelType = V.voxelType;
  voxelUnit = V.voxelUnit;
  voxelSize = V.voxelSize;
  relativeVoxelScaling = V.relativeVoxelScaling;
  skipheaderbytes = V.skipheaderbytes;
  mapping = V.mapping;
  slabSize = V.slabSize;
  repeatType = V.repeatType;

  return *this;
}
